﻿#include <iostream>
#include <string>
using namespace std;
void input(string& s1, string& s2,int i=0);//一个输入函数读入学院班级/学号姓名
struct student
{
	string name;
	string number;//防止超出longlong范围
};
struct classinfo
{
	string school;
	string classname; 
};
void output(student*, const int& i);
void output(classinfo);
int main()
{
	int size;
	string s1, s2;
	classinfo info;
	cout << "Please input the size of this class" << endl;
	cin >> size;
	struct student* StudentInfo = new student[size + 2];//防止数组越界
	input(s1, s2);
	info.school = s1;
	info.classname = s2;
	for (int i = 0; i < size; i++)
	{
		cout << "Please enter the " << i+1 << "th " << "student information" << endl;
		input(s1, s2, 1);
		StudentInfo[i].number = s1;
		StudentInfo[i].name = s2;
	}
	output(info);
	for (int i = 0; i < size; i++)
	{
		cout << "The " << i+1 << " th student information : " << endl;
		output(StudentInfo, i);
	}
}
//void input(string& s1, string& s2,int i=0)
void input(string& s1, string& s2, int i)
{
	if (i == 0)
	{
		cout << "Please enter School name" << endl;
		cin >> s1;
		cout << "Please enter Class name" << endl;
		cin >> s2;
	}
	else
	{
		cout << "Please enter student number" << endl;
		cin >> s1;
		cout << "Please enter student name" << endl;
		cin >> s2;
	}
}
void output(student *stu, const int& i)
{
	cout << "Student name: " << stu[i].name << endl;
	cout << "Student number" << stu[i].number << endl;
}
void output(classinfo info)
{
	cout << "School name: " << info.school << endl;
	cout << "Class name" << info.classname << endl;
}